﻿@model LibMS.Models.LibDocuments
@{
    ViewBag.Title = "DocumentDetail";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@section Header {
    <div class="row">
        <div class="col-lg-12">
            <h1>Chi tiết tài liệu <small>@Model.DocumentName.</small></h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-cog home"></i>Quản trị</a></li>
                <li><a href="#"><i class="fa fa-pencil-square-o home"></i>Quản lý tài liệu</a></li>
                <li class="active"><i class="fa fa-info-circle home"></i>Tài liệu chi tiết</li>
            </ol>
        </div>
    </div>
}

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">Thông tin tài liệu
                </h3>
            </div>

            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-4 pull-right">
                        <div class="input-group pull-right" style="margin-bottom: 20px;">
                            <input type="text" id="mainSearch" class="form-control" placeholder="Tìm kiếm tài liệu">
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button>
                            </span>
                        </div>
                    </div>
                </div>

                <table id="tableData" class="table table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Tài liệu</th>
                            <th>Ngày đăng</th>
                            <th>Danh mục</th>
                            <th>Tác giả</th>
                            <th>Số lượng</th>
                            <th>Lượt xem</th>
                            <th>Thao tác</th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (Convert.ToBoolean(ViewData["success"]) == true)
                        {
                            for (int i = 0; i < Model.ToArray().Length; i++)
                            {
                            <tr>
                                <td>@(i + 1)</td>
                                <td>@Model.ToArray()[i].DocumentName</td>
                                <td>@String.Format("{0:dd/MM/yyyy}", Model.ToArray()[i].CreateDate.GetValueOrDefault(Convert.ToDateTime("01/01/2013")))</td>
                                <td>@Model.ToArray()[i].CategoryName</td>
                                <td>@Model.ToArray()[i].Author</td>
                                <td>@Model.ToArray()[i].Total</td>
                                <td>@Model.ToArray()[i].ViewCount</td>
                                <td>
                                    <button class="btn btn-default btn-xs table-action" value="@Model.ToArray()[i].DocumentId"><i class="fa fa-info-circle"></i></button>
                                    <button class="btn btn-default btn-xs table-action" value="@Model.ToArray()[i].DocumentId"><i class="fa fa-trash-o"></i></button>
                                    <button class="btn btn-default btn-xs table-action" value="@Model.ToArray()[i].DocumentId"><i class="fa fa-upload"></i></button>
                                </td>
                            </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Modal title</h4>
            </div>
            <div class="modal-body">
                <!-- DocumentName-->
                <div class="form-group">
                    <label for="mdocumentName">Tên tài liệu</label>
                    <input type="text" class="form-control" id="mdocumentName" placeholder="Tên tài liệu">
                </div>
                <div class="row">
                    <div class="col-sm-6">
                        <!-- DocumentCategory-->
                        <div class="form-group">
                            <label for="mcategoryName">Danh mục</label>
                            <select class="form-control" id="mcategoryName">
                            </select>
                        </div>
                        <!-- KyHieu-->
                        <div class="form-group">
                            <label for="mkyHieu">Ký hiệu</label>
                            <input type="text" class="form-control" id="mkyHieu" placeholder="Ký hiệu">
                        </div>
                        <!-- DocumentAuthor-->
                        <div class="form-group">
                            <label for="mdocumentAuthor">Tác giả</label>
                            <input type="text" class="form-control" id="mdocumentAuthor" placeholder="Tác giả">
                        </div>
                        <!-- DocumentId-->
                        <div class="form-group">
                            <label for="mdocumentId">Id</label>
                            <input type="text" class="form-control" id="mdocumentId" disabled>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <!-- DocumentRack-->
                        <div class="form-group">
                            <label for="mdocumentRack">Rack</label>
                            <select class="form-control" id="mdocumentRack">
                            </select>
                        </div>
                        <!-- DocumentTotal-->
                        <div class="form-group">
                            <label for="mdocumentTotal">Số lượng</label>
                            <input type="text" class="form-control" id="mdocumentTotal" placeholder="Số lượng">
                        </div>
                        <!-- DocumentNXB-->
                        <div class="form-group">
                            <label for="mdocumentNXB">Nhà xuất bản</label>
                            <input type="text" class="form-control" id="mdocumentNXB" placeholder="Nhà xuất bản">
                        </div>
                        <!-- DocumentViewCount-->
                        <div class="form-group">
                            <label for="mdocumentViewCount">Lượt xem</label>
                            <input type="text" class="form-control" id="mdocumentViewCount" placeholder="Lượt xem" disabled>
                        </div>
                    </div>
                </div>
                <!-- DocumentDescription-->
                <div class="form-group">
                    <label for="mdocumentDescription">Mô tả tài liệu</label>
                    <textarea rows="3" class="form-control" id="mdocumentDescription" placeholder="Mô tả tài liệu"></textarea>
                </div>
            </div>    
            <div class="modal-footer" id="myModalFooter">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div><!-- /.modal-content -->        
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

@section JS {
    <script src="~/Scripts/App/LibDocuments/AdminListDocument.js"></script>
    <script type="text/javascript">
        var total = @ViewData["total"];
        var adminListDocument = new AdminListDocument(total, 10, 1, 'CreateDate');
        adminListDocument.Init();
    </script>
}